package com.amumu.drama.portal.modules.home.controller;

import com.amumu.drama.common.base.api.CommonResult;
import com.amumu.drama.common.modules.category.vo.GameVo;
import com.amumu.drama.model.SmsHomeAdvertise;
import com.amumu.drama.portal.dto.WholeSiteTransNotifyDto;
import com.amumu.drama.portal.service.HomeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 首页内容管理Controller
 * Created by macro on 2019/1/28.
 */
@RestController
@Api(tags = "首页内容")
@RequestMapping("/home")
public class HomeController {
    @Autowired
    private HomeService homeService;

    @ApiOperation("微丸子-全站交易公告")
    @GetMapping(value = "/wholeSiteTransNotify")
    public CommonResult<WholeSiteTransNotifyDto> wholeSiteTransNotify() {
        WholeSiteTransNotifyDto result = homeService.wholeSiteTransNotify();
        return CommonResult.success(result);
    }

    @ApiOperation("微丸子-获取首页推荐游戏列表")
    @GetMapping(value = "/recommendGameList")
    public CommonResult<List<GameVo>> recommendGameList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                        @RequestParam(value = "pageSize", defaultValue = "4") Integer pageSize) {
        return CommonResult.success(homeService.recommendGameList(pageNum, pageSize));
    }

    @ApiOperation("微丸子-首页轮播图信息")
    @GetMapping(value = "/homeAdvertise")
    public CommonResult<List<SmsHomeAdvertise>> homeAdvertise(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                              @RequestParam(value = "pageSize", defaultValue = "4") Integer pageSize,
                                                              @RequestParam(value = "type", defaultValue = "0") Integer type) {
        return CommonResult.success(homeService.homeAdvertise(type, pageSize, pageNum));
    }

//    @ApiOperation("首页内容信息展示")
//    @RequestMapping(value = "/content", method = RequestMethod.GET)
//    @ResponseBody
//    public CommonResult<HomeContentResult> content() {
//        HomeContentResult contentResult = homeService.content();
//        return CommonResult.success(contentResult);
//    }

//    @ApiOperation("分页获取推荐商品")
//    @RequestMapping(value = "/recommendProductList", method = RequestMethod.GET)
//    @ResponseBody
//    public CommonResult<List<PmsProduct>> recommendProductList(@RequestParam(value = "pageSize", defaultValue = "4") Integer pageSize,
//                                                               @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
//        List<PmsProduct> productList = homeService.recommendProductList(pageSize, pageNum);
//        return CommonResult.success(productList);
//    }

//    @ApiOperation("获取首页商品分类")
//    @RequestMapping(value = "/productCateList/{parentId}", method = RequestMethod.GET)
//    @ResponseBody
//    public CommonResult<List<PmsProductCategory>> getProductCateList(@PathVariable Long parentId) {
//        List<PmsProductCategory> productCategoryList = homeService.getProductCateList(parentId);
//        return CommonResult.success(productCategoryList);
//    }

//    @ApiOperation("根据分类获取专题")
//    @RequestMapping(value = "/subjectList", method = RequestMethod.GET)
//    @ResponseBody
//    public CommonResult<List<CmsSubject>> getSubjectList(@RequestParam(required = false) Long cateId,
//                                                         @RequestParam(value = "pageSize", defaultValue = "4") Integer pageSize,
//                                                         @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
//        List<CmsSubject> subjectList = homeService.getSubjectList(cateId,pageSize,pageNum);
//        return CommonResult.success(subjectList);
//    }

//    @ApiOperation("分页获取人气推荐商品")
//    @RequestMapping(value = "/hotProductList", method = RequestMethod.GET)
//    @ResponseBody
//    public CommonResult<List<PmsProduct>> hotProductList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
//                                                         @RequestParam(value = "pageSize", defaultValue = "6") Integer pageSize) {
//        List<PmsProduct> productList = homeService.hotProductList(pageNum,pageSize);
//        return CommonResult.success(productList);
//    }

//    @ApiOperation("分页获取新品推荐商品")
//    @RequestMapping(value = "/newProductList", method = RequestMethod.GET)
//    @ResponseBody
//    public CommonResult<List<PmsProduct>> newProductList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
//                                                         @RequestParam(value = "pageSize", defaultValue = "6") Integer pageSize) {
//        List<PmsProduct> productList = homeService.newProductList(pageNum,pageSize);
//        return CommonResult.success(productList);
//    }



}
